package com.naml.i_transtream;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @author marin
 * @version 1.0
 * @date 2025/4/25 19:29
 * @desc 将字节流转换为字符流进行数据的输出
 */
@SuppressWarnings("all")
public class OutputStreamWriter02 {
    public static void main(String[] args) {
        String path = "/Users/marin/new2.txt";
        BufferedWriter bw = null;
        try {
            bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path), "gbk"));
            bw.write("章三");
            bw.newLine();
            bw.write("你好啊");
        }catch (IOException e){
            e.printStackTrace();
        }finally {
            try {
                bw.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
